<?php
	require_once(realpath(dirname(__FILE__)) . "/pre.php");
	require_once(realpath(dirname(__FILE__)) . "/../classes/Administrateur.class.php");
	require_once(realpath(dirname(__FILE__)) . "/../classes/Navigation.class.php");
	
	session_start();
	header("Content-type: text/html; charset=utf-8");

	if(!isset($_SESSION["util"])) $_SESSION["util"]=new Administrateur();
		
	if(isset($_POST['identifiant']) && isset($_POST['motdepasse'])){
		$identifiant = str_replace(" ", "", $_POST['identifiant']);
		$motdepasse = str_replace(" ", "", $_POST['motdepasse']);
	}
		
    if($_POST['action'] == "identifier") {
           $admin = new Administrateur();
            if(! $admin->charger($identifiant, $motdepasse)) {header("Location: index.php");exit;}
            else{
                 $_SESSION["util"] = new Administrateur();
                 $_SESSION["util"] = $admin;

           }
    }

	if( ! isset($_SESSION["util"]->id) ) {header("Location: index.php");exit;}

	require_once(realpath(dirname(__FILE__)) . "/../fonctions/traduction.php");
	
	// chargement du fichier de langue
	if(! isset($_SESSION["util"]->lang) || ! $_SESSION["util"]->lang)
         $_SESSION["util"]->lang = 1;
    
    require_once(realpath(dirname(__FILE__)) . "/../client/lang/admin/" . $_SESSION["util"]->lang . ".php");
	
	ActionsAdminModules::instance()->inclure_module_admin("pre");		
	
?>